home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Future Workshop
/
Future Workshop.iso
/
multimed
/
qtw111
/
inc
/
qtcodec.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-22
|
15KB
|
334 lines
// ---------------------------------------------------------------------
//
// QTCODEC.H - QuickTime for Windows C and C++ Bindings
//
// Version 1.1
//
// (c) 1988-1993 Apple Computer, Inc. All Rights Reserved.
//
// ---------------------------------------------------------------------
#if !defined __QTCODEC_H
#define __QTCODEC_H
// Header files
#include <qtw.h>
#include <compmgr.h>
// Macros
#define ADDOFFSET(a,b) (LPBYTE)((char _huge *)(a)+(b))
#define SUBOFFSET(a,b) (LPBYTE)((char _huge *)(a)-(b))
#define HUGESUM(a,b,c) ADDOFFSET(a,FIELDOFFSET(b,c))
#define ROUNDUP(a,b) (((a)+(b-1))&(~(b-1)))
#define ROUNDDOWN(a,b) ((a)&(~(b-1)))
#define ROUNDDOWNSLOW(a,b) ((a)-((a)%(b)))
#define LOCAL static _near
#define GlobalDeref(a) GlobalLock(a)
// Data types
typedef short * PSHORT ;
typedef short FAR * LPSHORT ;
typedef BOOL * PBOOL ;
typedef BOOL FAR * LPBOOL ;
#define HUGE _huge
typedef char HUGE * HPSTR ;
typedef unsigned char HUGE * HPBYTE ;
typedef void HUGE * HPVOID ;
typedef LONG HUGE * HPLONG ;
typedef VOID ( FAR CDECL * HDWDISP)( ...) ;
// Data
enum OPT_TYPE { OPT_UNINIT = 0 // field uninitialized
, OPT_RAW = 1 // decompress to raw buffer
, OPT_BMP = 2 // decompress to BMP
, OPT_HDW = 3 // decompress to video adapter
} ;
enum BMP_TYPE { BMP_NONE = 0 // unknown type
, BMP_DIB = 1 // DIB
, BMP_MONO = 2 // monochrome
, BMP_PACKED_4 = 3 // packed 4 bit, e.g., Fahrenheit
, BMP_PLANAR_4 = 4 // VGA or SVGA
, BMP_INDEX_8 = 5 // palettized driver
, BMP_5_5_5 = 6 // 32,768 colors
, BMP_5_6_5 = 7 // XGA, Intel order
, BMP_PLANAR_16 = 8 // two planes of one byte each
, BMP_8_8_8_RGB = 9 // true color RGB
, BMP_MEMERR = 10 // insufficient memory for buffers
, BMP_8_8_8_BGR = 11 // true color BGR
, BMP_5_6_5_M = 12 // XGA, Motorola order
} ;
typedef LONG ImageSequence ;
// We regard as a limiting case a 1,600 x 1,200 screen with 3 bytes
// per pixel and a pixel pitch that is a power of 2, thus 8,192.
// This gives a bank break every 8 lines, for a total of 150 bank
// breaks.
#define MAXBANKBREAKS 150
#if !defined _MATRIX
#define _MATRIX
typedef LONG LFRACT ;
#define MAKELFRACT(value, fract) ((((DWORD)(fract))>>2) | (((DWORD)((WORD)(value))) << 30))
typedef struct { // Hungarian: mtrx
struct {
LFIXED lfxCol1 ;
LFIXED lfxCol2 ;
LFRACT lfrCol3 ;
} Row[ 3] ;
} MATRIX, FAR * LPMATRIX ;
#endif // !defined _MATRIX
#define ostypeAPPL QTFOURCC( 'a', 'p', 'p', 'l')
#define ostypeCVID QTFOURCC( 'c', 'v', 'i', 'd')
#define ostypeDCMP QTFOURCC( 'd', 'c', 'm', 'p')
#define ostypeJPEG QTFOURCC( 'j', 'p', 'e', 'g')
#define ostypeRAW QTFOURCC( 'r', 'a', 'w', ' ')
#define ostypeRLE QTFOURCC( 'r', 'l', 'e', ' ')
#define ostypeRPZA QTFOURCC( 'r', 'p', 'z', 'a')
#define ostypeRT21 QTFOURCC( 'r', 't', '2', '1')
#define ostypeSMC QTFOURCC( 's', 'm', 'c', ' ')
/* Codec function selectors
Codec selectors 0-127 are reserved by Apple
Codec selectors 128-191 are subtype specific
Codec selectors 192-255 are vendor specific
Codec selectors 256-32767 are reserved by Apple
Negative selectors are reserved by the Component Manager
*/
enum CODEC_SELECTOR { codecGetCodecInfo = 0
, codecGetCompressionTime = 1
, codecGetMaxCompressionSize = 2
, codecPreCompress = 3
, codecBandCompress = 4
, codecPreDecompress = 5
, codecBandDecompress = 6
, codecCDSequenceBusy = 7
, codecGetCompressedImageSize = 8
, codecGetSimilarity = 9
, codecTrimImage = 10
} ;
typedef struct tagCODECCAPABILITIES {
LONG lFlags ;
WORD wWantedPixelSize ;
WORD wExtendWidth ; // extra bytes after last row
WORD wExtendHeight ; // number of rows per compress unit
WORD wBandMin ;
WORD wBandInc ;
WORD wPad ;
WORD wTime ;
// new fields for Windows version
OPT_TYPE optt ; // the supported optimization
} CODECCAPABILITIES, FAR * LPCODECCAPABILITIES ;
typedef struct tagMASKBITS {
LPVOID lpBits ; // pointer to the bits
WORD wRowBytes ; // pixel pitch or BMP pitch
RECT rectBounds ; // clip rectangle
} MASKBITS, FAR * LPMASKBITS ;
// flags for lFlags in CODECCAPABILITIES
#define codecCanScale (1L << 0)
#define codecCanMask (1L << 1)
#define codecCanMatte (1L << 2)
#define codecCanTransform (1L << 3)
#define codecCanTransferMode (1L << 4)
#define codecCanCopyPrev (1L << 5)
#define codecCanSpool (1L << 6)
#define codecCanClipVertical (1L << 7)
#define codecCanClipRectangular (1L << 8)
#define codecCanRemapColor (1L << 9)
#define codecCanFastDither (1L << 10)
#define codecCanSrcExtract (1L << 11)
#define codecCanCopyPrevComp (1L << 12)
#define codecCanAsync (1L << 13)
#define codecCanMakeMask (1L << 14)
#define codecCanShift (1L << 15)
// flags for lConditionFlags in CODECDECOMPRESSPARAMETERS
#define codecConditionFirstBand (1L << 0)
#define codecConditionLastBand (1L << 1)
#define codecConditionCatchUp (1L << 2)
#define codecConditionCodecChangedMask (1L << 31)
typedef struct tagCODECDECOMPRESSPARAMS {
LONG lSequenceID ; // number of first frame
ImageDescription FAR * lpim ; // pointer to image description
LPVOID lpCompressed ; // pointer to compressed data
LONG lBufferSize ; // no image buffer size
LONG lFrameNumber ; // within the sequence
LONG lStartLine ; // starting line of band
LONG lStopLine ; // ending line of band
LONG lConditionFlags ; // how component has been called
LONG lCallerFlags ; // further control information
LPCODECCAPABILITIES lpCapabilities ; // filled out by PreDecompress
LPVOID lpvProgressProc ; // no progress proc
LPVOID lpvCompletionProc ; // no completion proc
LPVOID lpvDataProc ; // no data loading proc
HDC hdc ; // instead of CGrafPtr
LPVOID lpUncompressed ; // pointer to offscreen buffer
LPMASKBITS lpMaskBits ; // mask bits structure
LPVOID lpMattePixMap ; // blend matte (unused)
RECT rectSample ; // subset of sample to decompress
LPMATRIX lpMatrix ; // target transformation matrix
BYTE bAccuracy ; // requested accuracy
BYTE bAlign ; // for alignment only
WORD wRop2 ; // usually R2_COPYPEN
WORD wMatrixType ; // identify 0.5X, 2X, 4X
RECT rectDest ; // destination rectangle
// new fields for Windows version
LONG lCompressedSize ; // size of compressed data
BMP_TYPE bmpt ; // BMP type
LPVOID lpDitherTable ; // pointer to dither table
WORD wClutSeed ; // track CLUT changes
OPT_TYPE optt ; // optimization type
HDWDISP lpvHardware ; // addr of adapter dispatch routine
LPWORD lpwBankBoundaries ; // adapter's bank boundary table
LPWORD lpwBitSmear ; // bit smearing table
WORD wRowsPerFullSegment ; // banding will obsolete this
LPVOID lpOffScreen ; // offscreen handling of bank splits
DWORD dwReserved[ 1] ; // room for expansion
} CODECDECOMPRESSPARAMS, FAR * LPCODECDECOMPRESSPARAMS ;
typedef struct tagCODECINFO {
char szTypeName[ 32] ; // name of codec type
WORD wVersion ;
WORD wRevLevel ;
DWORD dwVendor ;
DWORD dwDecompressFlags ;
DWORD dwCompressFlags ;
DWORD dwFormatFlags ;
BYTE bDecompressionAccuracy ;
WORD wCompressionSpeed ;
WORD wDecompressionSpeed ;
BYTE bCompressionLevel ;
BYTE bReserved ;
WORD wMinimumHeight ;
WORD wMinimumWidth ;
WORD wDecompressPipelineLatency ;
WORD wCompressPipelineLatency ;
DWORD dwPrivateData ;
} CODECINFO, FAR * LPCODECINFO ;
// flags for dwComponentFlags in ComponentDescription structure
// flags for dwDecompressFlags and dwCompressFlags in CODECINFO
// The depths refer to target depths supported.
#define codecInfoDoes1 (1L << 0)
#define codecInfoDoes4 (1L << 1)
#define codecInfoDoes8 (1L << 2)
#define codecInfoDoes16 (1L << 3)
#define codecInfoDoes24 (1L << 4)
#define codecInfoDoes32 (1L << 5)
#define codecInfoDoesDither (1L << 6)
#define codecInfoDoesStretch (1L << 7)
#define codecInfoDoesShrink (1L << 8)
#define codecInfoDoesMask (1L << 9)
#define codecInfoDoesTemporal (1L << 10)
#define codecInfoDoesDouble (1L << 11)
#define codecInfoDoesQuad (1L << 12)
#define codecInfoDoesHalf (1L << 13)
#define codecInfoDoesQuarter (1L << 14)
#define codecInfoDoesRotate (1L << 15)
#define codecInfoDoesHorizFlip (1L << 16)
#define codecInfoDoesVertFlip (1L << 17)
#define codecInfoDoesSkew (1L << 18)
#define codecInfoDoesBlend (1L << 19)
#define codecInfoDoesWarp (1L << 20)
#define codecInfoDoesRecompress (1L << 21)
#define codecInfoDoesSpool (1L << 22)
// flags for dwFormatFlags in CODECINFO
// The depths refer to source depths supported.
#define codecInfoDepth1 (1L << 0)
#define codecInfoDepth2 (1L << 1)
#define codecInfoDepth4 (1L << 2)
#define codecInfoDepth8 (1L << 3)
#define codecInfoDepth16 (1L << 4)
#define codecInfoDepth24 (1L << 5)
#define codecInfoDepth32 (1L << 6)
#define codecInfoDepth33 (1L << 7)
#define codecInfoDepth34 (1L << 8)
#define codecInfoDepth36 (1L << 9)
#define codecInfoDepth40 (1L << 10)
#define codecInfoStoresClut (1L << 11)
#define codecInfoDoesLossless (1L << 12)
#define codecInfoSeqSensitive (1L << 13)
// Functions
#if defined __cplusplus
extern "C" {
#endif
ComponentResult QTAPI cfBandDecompress( STKOFF_CMP so
, LPVOID lpvStorage
, LPCODECDECOMPRESSPARAMS lpdecomp
) ;
ComponentResult QTAPI cfCanDoSelect( STKOFF_CMP so, LONG lFunctionSelector) ;
ComponentResult QTAPI cfCloseSelect( STKOFF_CMP so, ComponentInstance ci) ;
ComponentResult QTAPI cfGetCodecInfo( STKOFF_CMP so
, LPVOID lpvStorage
, LPCODECINFO lpinfo
) ;
ComponentResult QTAPI cfOpenSelect( STKOFF_CMP so, ComponentInstance ci) ;
ComponentResult QTAPI cfPreDecompress( STKOFF_CMP so
, LPVOID lpvStorage
, LPCODECDECOMPRESSPARAMS lpdecomp
) ;
ComponentResult QTAPI cfRegisterSelect( STKOFF_CMP so, ComponentInstance ci) ;
ComponentResult QTAPI cfSequenceBusy( STKOFF_CMP so
, LPVOID lpvStorage
, ImageSequence seq
) ;
ComponentResult QTAPI cfTargetSelect( STKOFF_CMP so, ComponentInstance ci) ;
ComponentResult QTAPI cfVersionSelect( STKOFF_CMP so, ComponentInstance ci) ;
DWORD QTAPI CodecEntry( VOID) ;
VOID QTAPI CopyMemory( HPVOID hpvDest, HPVOID hpvSource, LONG cbCopy) ;
WORD QTAPI Flip16( WORD wValue) ;
VOID QTAPI Flip16Many( LPVOID lpSource, DWORD dwNbrWords) ;
LONG QTAPI Flip32( LONG lValue) ;
VOID QTAPI Flip32Many( LPVOID lpSource, DWORD dwNbrDwords) ;
BOOL QTAPI FreeMemory( LPVOID lpvMem) ;
LPVOID QTAPI GetMemory( LONG lSize) ;
LPVOID QTAPI ReallocateMemory( LPVOID lpvMem, LONG lSize) ;
OSType FAR PASCAL THNGIDENTIFY( LPCID FAR *lplpcid) ;
VOID QTAPI VidComputeBankBoundaries1( LPWORD lpSourceTable
, LPWORD lpTargetTable
, WORD wLeft
, WORD wTop
, WORD wRight
, WORD wBottom
) ;
VOID QTAPI VidComputeBankBoundaries2( LPWORD lpSourceTable
, LPWORD lpTargetTable
, WORD wLeft
, WORD wTop
, WORD wRight
, WORD wBottom
) ;
VOID QTAPI VidComputeBankBoundaries4( LPWORD lpSourceTable
, LPWORD lpTargetTable
, WORD wLeft
, WORD wTop
, WORD wRight
, WORD wBottom
) ;
VOID QTAPI VidComputeBankBoundaries81( LPWORD lpSourceTable
, LPWORD lpTargetTable
, WORD wLeft
, WORD wTop
, WORD wRight
, WORD wBottom
) ;
VOID QTAPI VidComputeBankBoundaries82( LPWORD lpSourceTable
, LPWORD lpTargetTable
, WORD wLeft
, WORD wTop
, WORD wRight
, WORD wBottom
) ;
BMP_TYPE QTAPI VidGetBMPType() ;
#if defined __cplusplus
} // defined __cplusplus
#endif
#endif // !defined __QTCODEC_H